<?php
require_once(dirname(dirname(dirname(__FILE__))) . '/app.php');

need_manager();
need_auth('team');


$action = strval($_GET['action']);
$id = abs(intval($_GET["id"]));


if( 'changecity' == $action ){
	if( $id != 0){
		$condition = array(
				'zone' => 'district',
				'display' => 'Y',
				'fid' => $id,
		);
		$districts = DB::LimitQuery('category', array(
				'condition' => $condition,
				'order' => 'ORDER BY id DESC',
		));
		
		if(!$districts) die('<option value="0">暂无该市的分区信息</option>');
	}

	$districts[] = array( 'id'=> 0, 'name'=>'选择市内分区');
	$districts = Utility::OptionArray($districts, 'id', 'name');
	die (Utility::Option($districts));
}else if( 'changedistrict' == $action ){
	if( $id != 0){
		$condition = array(
				'zone' => 'businessd',
				'display' => 'Y',
				'fid' => $id,
		);
		
		$businessds = DB::LimitQuery('category', array(
				'condition' => $condition,
				'order' => 'ORDER BY id DESC',
		));
		if(!$businessds) die('<option value="0">暂无该区的商区信息</option>');
		
	}
	$businessds[] = array( 'id'=> 0, 'name'=>'选择商区');
	$businessds = Utility::OptionArray($businessds, 'id', 'name');
	die (Utility::Option($businessds));
}







